<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/9/9/009
 * Time: 21:22
 */

namespace App\Models\nursery;


use App\Models\base\traits\HasOwner;
use App\Models\base\traits\ImgTrait;
use App\Models\Model;

/**
 * App\Models\nursery\Check
 *
 * @property int $id
 * @property int $user_id
 * @property string $real_name 真实姓名
 * @property int $sex 性别  1男2女
 * @property int $age 年龄
 * @property int $job_age 工作年龄
 * @property string $card 身份证号码
 * @property string $service_area 服务区域
 * @property string $majors 擅长专业ID
 * @property string $brief 简介
 * @property string $imgs 审核图片
 * @property string|null $remark 后台审核意见
 * @property int $status 0 => '驳回', 1 => '通过', 2 => '待审核'
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read mixed $header_img
 * @property-read mixed $icon
 * @property mixed $icons
 * @property mixed $img
 * @property mixed $parameter
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereAge($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereBrief($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereCard($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereImgs($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereJobAge($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereMajors($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereRealName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereRemark($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereServiceArea($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereSex($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereUserId($value)
 * @mixin \Eloquent
 * @property-read \App\Models\User $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check owner($userId)
 * @property int $num 服务客户数
 * @property float $star 评分
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\nursery\Check whereStar($value)
 */
class Check extends Model
{

    use ImgTrait,HasOwner;


    public function getMajorsAttribute($value)
    {
        return explode(',', $value);
    }

    public function setMajorsAttribute($value)
    {
        if (is_array($value)){
            $this->attributes['majors'] = implode(',', $value);
        }else{
            $this->attributes['majors'] = $value;
        }
    }

    protected $fillable = [
        'user_id',
        'real_name',
        'sex',
        'age',
        'job_age',
        'card',
        'service_area',
        'majors',
        'brief',
        'imgs',
        'status'
    ];


}